#ifndef NETWORKSERVICES_ACCEPTOR_H
#define NETWORKSERVICES_ACCEPTOR_H

#include <string>
#include <functional>
#include <memory>
#include "HSocket.h"

class Channel;
class EventLoop;

class Acceptor {
public:
    Acceptor(EventLoop *loop, const std::string &ip, uint16_t port);
    ~Acceptor();
    void OnConnection() const;

public:
    std::function<void(Socket&)> onConnection;

private:
    Socket servSock;
    std::unique_ptr<Channel> channel;
    EventLoop *loop;
};


#endif //NETWORKSERVICES_ACCEPTOR_H
